package com.platform.server.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.platform.server.dao.TopicDao;
import com.platform.server.service.TopicService;

@Service
public class TopicServiceImpl implements TopicService {

	@Autowired
	private TopicDao topicDao;
	
	/**
	 * 话题列表
	 */
	@Override
	public List<Map<String, Object>> selectTopicList(String startTime,String endTime,String is_ban,String topic_title) {
		Map<String,Object> map = new HashMap<>();
		map.put("startTime", startTime);
		map.put("endTime", endTime);
		map.put("is_ban", is_ban);
		map.put("topic_title", topic_title);
		return topicDao.selectTopicList(map);
	}

	/**
	 * 删除话题
	 */
	@Override
	public int deleteTopic(String id) {
		return topicDao.deleteTopic(id);
	}

	/**
	 * 修改话题状态
	 */
	@Override
	public int updateTopicStatus(Integer id, String is_ban) {
		Map<String,Object> map = new HashMap<>();
		map.put("id", id);
		map.put("is_ban", is_ban);
		return topicDao.updateTopicStatus(map);
	}

	/**
	 * 添加话题
	 */
	@Override
	public int insertTopic(String topic_title, String topic_image, String is_ban) {
		return topicDao.insertTopic(topic_title, topic_image, is_ban);
	}

	/**
	 * 话题动态列表
	 */
	@Override
	public List<Map<String, Object>> selectTopicDynamic(String topic_id,String startTime,String endTime,String username) {
		Map<String,Object> map = new HashMap<>();
		map.put("topic_id", topic_id);
		map.put("startTime", startTime);
		map.put("endTime", endTime);
		map.put("username", username);
		return topicDao.selectTopicDynamic(map);
	}

	/**
	 * 删除话题动态
	 */
	@Override
	public int deleteTopicDynamic(String id) {
		return topicDao.deleteTopicDynamic(id);
	}

	/**
	 * 查看话题动态的点赞信息
	 */
	@Override
	public List<Map<String, Object>> selectTopicLike(String topic_dynamic_id) {
		return topicDao.selectTopicLike(topic_dynamic_id);
	}

	/**
	 * 查看话题动态的评论信息
	 */
	@Override
	public List<Map<String, Object>> selectTopicComment(String topic_dynamic_id) {
		return topicDao.selectTopicComment(topic_dynamic_id);
	}

	/**
	 * 删除评论消息
	 */
	@Override
	public int deleteCommentMessage(Integer id) {
		return topicDao.deleteCommentMessage(id);
	}

}
